< previous page page_612 next page >

Page 612
Version 2.0 of ActiveX Data Objects (ADO) is the latest entry in to the VB data access arena. It provides a way for you to interact with various types of databases from your Visual Basic programs, ActiveX components, and Active Server Pages. This chapter introduces ADO and demonstrates some of its key features.
Introducing ADO
ActiveX Data Objects, or ADO, is the most recent method of data access that Microsoft has introduced. ADO is intended to replace DAO (Data Access Objects), the original method of Visual Basic database access, and RDO (Remote Data Objects), a fast alternative to DAO. As with either of these object models, ADO provides several options for accessing your data. In this section, you briefly look at the steps and strategies necessary to set up a connection to data using ADO.
Data Connection Methods
ADO provides the means by which your program code accesses a database. But how does ADO itself connect to a database? The answer is through an OLE DB provider. OLE DB is Microsoft's new lower-level database interface that provides access to many different kinds of data. There are OLE DB providers for both traditional databases (such as SQL server) as well as other sources like an e-mail server. The OLE DB provider exposes these databases to ADO, which in turn allows you to connect to the data in the following ways:
Data controls. A Data control is a custom control that handles communication with the database. You simply set a few properties and "bind" some other controls to the Data control to display information.
Object interface. When you add a reference to ADO, a new set of objects becomes available to your program. You can manipulate data directly from code without any controls or combine the use of objects with a Data control.
The Data control is quick and easy to set up, but using the object interface provides more power and flexibility. In this chapter, you examine both methods as they relate to ADO.
Installation
If the past is any indicator, by the time you read this chapter, Microsoft will have come out with patches and service packs for many of its products. Before you start using ADO, it is worth your while to download and install the latest version. At the time of this writing, Visual Basic 6.0 includes ADO 2.0, and Visual Basic 5.0 users can download version 1.5c. The Microsoft Data Access Components (MSDAC) package includes ADO files and documentation, the latest version of ODBC, and Remote Data Services. You can find the Web site at http://www.microsoft/com/data/ado.
tip.gif
When you are installing the updated Data Access Components, select Custom Installation and make sure that you choose to install ADO documentation and the Access database driver.

 
< previous page page_612 next page >